﻿using Microsoft.AspNetCore.Identity;
using Apex.DomainCommons.Models;

namespace IdentityService.Domain;
public class User : IdentityUser<Guid>, IHasCreationTime, IHasDeletionTime, ISoftDelete
{
    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreationTime { get; init; }
    /// <summary>
    /// 伪删除时间
    /// </summary>
    public DateTime? DeletionTime { get; private set; }
    /// <summary>
    /// 是否伪删除
    /// </summary>
    public bool IsDeleted { get; private set; }
    /// <summary>
    /// 初始化
    /// </summary>
    /// <param name="userName"></param>
    public User(string userName) : base(userName)
    {
        Id = Guid.NewGuid();
        CreationTime = DateTime.Now;
    }
    /// <summary>
    /// 伪删除方法
    /// </summary>
    public void SoftDelete()
    {
        this.IsDeleted = true;
        this.DeletionTime = DateTime.Now;
    }
}
